<template>

  <el-main>
    <el-table
        :data="tableData"
        style="width: 100%">
      <el-table-column
          prop="comAddress"
          label="合同地址"
          width="180">
      </el-table-column>
      <el-table-column
          prop="dateEnd"
          label="结束时间"
          width="180">
      </el-table-column>
      <el-table-column
          prop="dateStart"
          label="开始时间">
      </el-table-column>
      <el-table-column
          label="操作">
        <template slot-scope="scope">
          <el-button @click="exportById(scope.row.id)">导出</el-button>
          <el-button @click="preview">预览</el-button>
        </template>
      </el-table-column>
    </el-table>

  </el-main>

</template>

<script>
export default {
  name: "Contract",
  data() {
    return{
      tableData: [],
      queryForm: {
        email: '87941125@qq.com'
      }
    }
  },
  methods:{

    page() {
      this.axios.get('/hetong/page', {params: this.queryForm}).then(res => {
        this.tableData = res.data.data.records;
      });
    },
    exportById(id) {
      // window.location.href = this.axios.defaults.baseURL + 'hetong/exportById?id=' + id;
      window.open(this.axios.defaults.baseURL + 'hetong/exportById?id=' + id, "_blank");
    },
    preview(id) {
      // window.location.href = this.axios.defaults.baseURL + 'hetong/preview';
      window.open(this.axios.defaults.baseURL + 'hetong/preview');
    }

  },
  created() {
    this.page();
  },
  mounted() {

  }
}
</script>

<style scoped>

</style>